package fr.inria.arles.tempManagement.preferencesStore.query;

import java.sql.ResultSet;

/**
 * A Query to retrieve the current reference temperate setting.
 */
public class RFIDQuery extends AbstractQuery {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * fr.inria.arles.tempManagement.queryProcessor.query.AbstractQuery#execute
	 * (java.lang.String[])
	 */
	@Override
	public String execute(String[] args) throws Exception {
		ResultSet rs = executeQuery("SELECT ID FROM TEMPERATURE "
				+ "WHERE RFID=? AND PARTITION=?", args);
		if (rs.next()) {
			return rs.getString("ID");
		} else {
			throw new Exception("Authentication Failed");
		}
	}

}
